package com.jubaozan.service.platform.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jubaozan.c3.framework.constants.Constants;
import com.jubaozan.c3.framework.utils.PageHolder;
import com.jubaozan.c3.framework.utils.ResultHolder;
import com.jubaozan.feign.goods.vo.GoodsVO;
import com.jubaozan.feign.goods.vo.StoreGoodsVO;
import com.jubaozan.service.platform.decorator.PlatformActivityLogDecorator;
import com.jubaozan.feign.platform.activity.vo.ActivityLogVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * @ClassName PlatformActivityLogController
 * @Description 个体平台活动日志相关接口
 * @Author TanRuixiang
 * @Date 2020/9/24 10:44
 * @Version 1.0
 **/
@Api(tags = {"个体平台活动日志相关接口"}, value = "个体平台活动日志相关接口")
@RestController
@RequestMapping("/activity/log")
@Validated
public class PlatformActivityLogController {

    private final PlatformActivityLogDecorator platformActivityLogDecorator;

    public PlatformActivityLogController(PlatformActivityLogDecorator platformActivityLogDecorator) {
        this.platformActivityLogDecorator = platformActivityLogDecorator;
    }

    @ApiOperation(value = "根据平台id获取活动信息")
    @GetMapping("/")
    public ResultHolder<ActivityLogVO> getActivityByStoreId(@RequestParam(value = "storeId") Long storeId) {
        return ResultHolder.success(platformActivityLogDecorator.getActivityByStoreId(storeId));
    }

    @ApiOperation(value = "根据平台id活动下的商品列表")
    @GetMapping("/activity/log/goods")
   public ResultHolder<IPage<StoreGoodsVO>> getGoodsListByStoreId(@RequestHeader(Constants.KEY_X_C3_AGENTID) Long userId,
                                                                  @RequestParam("storeId")Long storeId, @RequestParam("pageHolder") PageHolder pageHolder){
        return ResultHolder.success(platformActivityLogDecorator.getGoodsListByStoreId(storeId,userId,pageHolder));
    }
}
